-
-
Notifications
You must be signed in to change notification settings - Fork 478
feat: support role
prop in RcSelect for accessibility
#1165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough在 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @jsh1400, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial accessibility enhancement to the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds support for the role
prop to enhance accessibility, which is a great improvement. The implementation correctly passes the prop down to the underlying DOM element. However, the explicit addition of role
to the SelectProps
interface appears to be redundant, as it should already be available through type inheritance. I've left a comment with a suggestion to remove the redundant type definition for better code clarity.
|
||
// >>> Accessibility | ||
// https://github.com/ant-design/ant-design/issues/46030 | ||
// https://github.com/ant-design/ant-design/issues/53713 | ||
// https://github.com/ant-design/ant-design/pull/55185#discussion_r2389642896 | ||
role?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While adding support for the role
prop is a good accessibility improvement, explicitly adding it to the SelectProps
interface appears to be redundant. The SelectProps
interface inherits properties from BaseSelectProps
, which in turn extends React.AriaAttributes
. Since role
is part of React.AriaAttributes
, it should already be available on SelectProps
through type inheritance.
To avoid redundancy and keep the interface definition cleaner, you can remove this explicit declaration. The functionality should remain the same.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1165 +/- ##
=======================================
Coverage 98.11% 98.11%
=======================================
Files 39 39
Lines 1489 1489
Branches 452 452
=======================================
Hits 1461 1461
Misses 28 28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi 👋 Thanks for reviewing my PR! This fix is important for addressing related issues in Ant Design:
All checks have passed, and the changes can be cleanly merged. |
Motivation
Currently,
<RcSelect />
does not accept therole
prop as an input, which prevents developers from explicitly defining accessibility roles (e.g.,role="combobox"
).This causes accessibility checkers to report errors such as
ARIA attribute is not allowed: aria-required="true"
because the element lacks a supported role.What I changed
role?: string
toSelectProps
type.role
prop down to the root element of RcSelect.Impact
Developers can now explicitly set
role="combobox"
(or other ARIA-supported roles) on<Select />
, ensuring proper accessibility compliance.Related
aria-required
is used on<Select />
.Summary by CodeRabbit